package org.charles.zhifou.model.dto.scoringResult;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import org.charles.zhifou.common.enums.CodeToEnumDeserializer;
import org.charles.zhifou.enums.SqlSortOrderEnum;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

/**
 * 查询评分结果请求
 *
 * @author Charles
 * @version 1.0
 */
@Data
public class ScoringResultQueryRequest implements Serializable {

    @Schema(description = "id")
    @Min(value = 1, message = "id 必须大于 0")
    private Long id;

    @Schema(description = "结果名称")
    @Length(max = 32, message = "结果名称长度不能超过 32 个字符")
    private String resultName;

    @Length(max = 256, message = "结果描述长度不能超过 256 个字符")
    @Schema(description = "结果描述")
    private String resultDesc;

    @Schema(description = "结果图片")
    private String resultPicture;

    @Schema(description = "结果属性集合 JSON，如 [I,S,T,J]")
    private String resultProp;

    @Schema(description = "结果得分范围，如 80，表示 80及以上的分数命中此结果")
    private Integer resultScoreRange;

    @Schema(description = "应用 id")
    @Min(value = 1, message = "查询的应用 id 必须大于 0")
    private Long appId;

    @Schema(description = "创建用户 id")
    @Min(value = 1, message = "查询的创建用户 id 必须大于 0")
    private Long userId;

    @Schema(description = "id")
    @Min(value = 1, message = "规避查询的 id 必须大于 0")
    private Long notId;

    @Schema(description = "搜索词")
    private String searchText;

    @Schema(description = "当前页号")
    @Min(value = 1, message = "当前页号必须大于 0")
    private int current = 1;

    @Schema(description = "页面大小")
    @Min(value = 1, message = "页面大小必须大于 0")
    private int pageSize = 10;

    @Schema(description = "排序字段")
    private String sortField;

    @Schema(description = "排序顺序 (默认升序)")
    @JsonDeserialize(using = CodeToEnumDeserializer.class)
    private SqlSortOrderEnum sortOrder = SqlSortOrderEnum.ASC;

    @Serial
    private static final long serialVersionUID = 1L;
}